{#
  Renders an author info snippet.
  If there's no data for the author, just renders their ID. This isn't ideal but is better than
  crashing.
#}
{% macro postAuthor(authorId, locale) %}

{% set author = authorsData[authorId] %}

<div class="display-flex align-start">
  {% if author.image %}
    {% Img
      class="rounded-full flex-shrink-none width-600 height-600 object-fit-cover",
      src=author.image,
      alt=author.name.given + author.name.family,
      width="40",
      height="40",
      options={minWidth: 40, maxWidth: 120}
    %}
  {% endif %}
  <div class="display-flex direction-column align-start gap-left-300 type--small">
    {% if author %}
      {# Add a nbsp so authors' names don't break and wrap between the first and last name. #}
      <p>{{ author.name.given }}&nbsp;{{ author.name.family }}</p>
      <p class="color-secondary-text">{{ author.descriptions[locale] }}</p>
    {% else %}
      <p>{{ authorId }}</p>
    {% endif %}
  </div>
</div>

{% endmacro %}
